package dp.mobile.entity;

import java.io.Serializable;

import javax.microedition.khronos.opengles.GL10;

import dp.mobile.game.Player;
import dp.mobile.system.Utilities;

public abstract class Entity implements Serializable {
	protected Entity() {
		mID = ++sEntityID % 2147483647;
	}
	
	public Entity(Player player) {
		this();
		mPlayer = player;
	}
	
	public Player getPlayer() {
		return mPlayer;
	}
	
	private static final long serialVersionUID = -4111599306477213796L;
	//Accessors
	public int getX()		{	return getTileX() * Utilities.TILE_WIDTH;	}
	public int getY()		{	return getTileY() * Utilities.TILE_HEIGHT;	}
    public int getTileX()	{	return mTileX;								}
    public int getTileY()	{	return mTileY;								}
    public int getID()		{	return mID;									}
    public String getName()	{	return mName;								}
    
    public void setID(int id) {
    	mID = id;
    } 

    public abstract void draw(GL10 gl);

    //Position
	protected int mTileX;
	protected int mTileY;
	
	//Identifier
	protected int mID;
	protected Player mPlayer;
	protected String mName;
	
	protected static int sEntityID = 0;
}
